<template>
  <div id="mainbox">
    <div class="top">
      <img src="/hlogo.png" alt="" />
      <p>早上好！{{ user.username }}</p>
    </div>
    <div class="top2">
      <div class="box">
        <div class="left">
          <p>新增用户数量</p>
          <h1>1089</h1>
          <p class="txt">较上周 <span>+20%</span></p>
        </div>
        <div class="right">
          <img src="/home1.png" alt="" />
        </div>
      </div>
      <div class="box">
        <div class="left">
          <p>新增工单数量</p>
          <h1>1089</h1>
          <p class="txt">较上周 <span>+20%</span></p>
        </div>
        <div class="right">
          <img src="/home2.png" alt="" />
        </div>
      </div>
      <div class="box">
        <div class="left">
          <p>新增订单数量</p>
          <h1>1089</h1>
          <p class="txt">较上周 <span class="fu">-20%</span></p>
        </div>
        <div class="right">
          <img src="/home3.png" alt="" />
        </div>
      </div>
      <div class="box">
        <div class="left">
          <p>新增动态数量</p>
          <h1>1089</h1>
          <p class="txt">较上周 <span>+20%</span></p>
        </div>
        <div class="right">
          <img src="/home4.png" alt="" />
        </div>
      </div>
    </div>
    <div class="top3">
      <div class="box bigbox">
        <p class="txt1">快捷入口</p>
        <div class="main">
          <div class="aaa">
            <p class="one">
              <img src="/hom1.svg" alt="" />
            </p>
            <span>全部用户</span>
          </div>
          <div class="aaa">
            <p class="two">
              <img src="/hom2.svg" alt="" />
            </p>
            <span>报告管理</span>
          </div>
          <div class="aaa">
            <p class="three">
              <img src="/hom3.svg" alt="" />
            </p>
            <span>会话</span>
          </div>
          <div class="aaa">
            <p class="four">
              <img src="/hom4.svg" alt="" />
            </p>
            <span>全部订单</span>
          </div>
          <div class="aaa">
            <p class="four">
              <img src="/hom5.svg" alt="" />
            </p>
            <span>工单管理</span>
          </div>
          <div class="aaa">
            <p class="one">
              <img src="/hom6.svg" alt="" />
            </p>
            <span>审核管理</span>
          </div>
          <div class="aaa">
            <p class="two">
              <img src="/hom7.svg" alt="" />
            </p>
            <span>售后管理</span>
          </div>
          <div class="aaa">
            <p class="three">
              <img src="/hom8.svg" alt="" />
            </p>
            <span>动态管理</span>
          </div>
        </div>
      </div>
      <div class="box">
        <p class="txt1">用户标签分布</p>
        <div class="main">
          <Biao1></Biao1>
        </div>
      </div>
      <div class="box">
        <p class="txt1">各服务类型商品订单量占比</p>
        <div class="main">
          <Biao2></Biao2>
        </div>
      </div>
    </div>
    <div class="top4">
      <p class="txt1">用户趋势统计</p>
      <div class="cenbox">
        <Biao3></Biao3>
      </div>
    </div>
    <div class="bottom">
      <div class="boxten">
        <p class="txt1">支付榜TOP5商品排行</p>
        <div>
          <tiny-grid
            :data="tableData"
            :header-row-class-name="headerRowClassName"
            height="350"
          >
            <tiny-grid-column type="index" width="60" title="序号"></tiny-grid-column>
            <tiny-grid-column field="name" title="商品信息">
              <template #default="slot">
                <div class="oneslot" style="display: flex; align-items: center">
                  <img :src="slot.row.img" width="36" height="36" alt="" />
                  <p class="text" style="position: relative; top: 10px; left: 10px">
                    {{ slot.row.name }}
                  </p>
                </div>
              </template>
            </tiny-grid-column>
            <tiny-grid-column field="employees" title="支付订单数"></tiny-grid-column>
          </tiny-grid>
        </div>
      </div>
      <div class="boxten">
        <p class="txt1">服务人员业绩TOP5排行</p>
        <div>
          <tiny-grid
            :data="tableData"
            :header-row-class-name="headerRowClassName"
            height="350"
          >
            <tiny-grid-column type="index" width="60" title="序号"></tiny-grid-column>
            <tiny-grid-column field="name" title="商品信息">
              <template #default="slot">
                <div class="oneslot" style="display: flex; align-items: center">
                  <img :src="slot.row.img" width="36" height="36" alt="" />
                  <p class="text" style="position: relative; top: 10px; left: 10px">
                    {{ slot.row.name }}
                  </p>
                </div>
              </template>
            </tiny-grid-column>
            <tiny-grid-column field="employees" title="支付订单数"></tiny-grid-column>
          </tiny-grid>
        </div>
      </div>
    </div>
  </div>
</template>
<script setup>
import Biao1 from "./Biao1.vue";
import Biao2 from "./Biao2.vue";
import Biao3 from "./Biao3.vue";
import { ref, reactive, watch } from "vue";
import { TinyGrid, TinyGridColumn, TinyTooltip } from "@opentiny/vue";

const tableData = ref([
  {
    id: "1",
    name: "GFD科技YX公司",
    city: "福州",
    employees: 800,
    createdDate: "2014-04-30 00:56:00",
    img:
      "https://ts1.cn.mm.bing.net/th/id/R-C.8a3eceef33d1599e9c4145d02f6e664c?rik=pJio3RYnkfUHzQ&riu=http%3a%2f%2fk.sinaimg.cn%2fn%2fsinakd20240716ac%2f439%2fw690h549%2f20240716%2f2029-7c53d43dd1f41d09507bc21860931b51.jpg%2fw700d1q75cms.jpg&ehk=ndOkDNmTG2rf7rfLf%2fTDtul7Hmq27fzksVxYpD44hQc%3d&risl=&pid=ImgRaw&r=0",
  },
  {
    id: "2",
    name: "WWW科技YX公司",
    city: "深圳",
    employees: 300,
    createdDate: "2016-07-08 12:36:22",
    img:
      "https://ts1.cn.mm.bing.net/th/id/R-C.8a3eceef33d1599e9c4145d02f6e664c?rik=pJio3RYnkfUHzQ&riu=http%3a%2f%2fk.sinaimg.cn%2fn%2fsinakd20240716ac%2f439%2fw690h549%2f20240716%2f2029-7c53d43dd1f41d09507bc21860931b51.jpg%2fw700d1q75cms.jpg&ehk=ndOkDNmTG2rf7rfLf%2fTDtul7Hmq27fzksVxYpD44hQc%3d&risl=&pid=ImgRaw&r=0",
  },
  {
    id: "3",
    name: "RFV有限责任公司",
    city: "中山",
    employees: 1300,
    createdDate: "2014-02-14 14:14:14",
    img:
      "https://ts1.cn.mm.bing.net/th/id/R-C.8a3eceef33d1599e9c4145d02f6e664c?rik=pJio3RYnkfUHzQ&riu=http%3a%2f%2fk.sinaimg.cn%2fn%2fsinakd20240716ac%2f439%2fw690h549%2f20240716%2f2029-7c53d43dd1f41d09507bc21860931b51.jpg%2fw700d1q75cms.jpg&ehk=ndOkDNmTG2rf7rfLf%2fTDtul7Hmq27fzksVxYpD44hQc%3d&risl=&pid=ImgRaw&r=0",
  },
  {
    id: "4",
    name: "TGB科技YX公司",
    city: "龙岩",
    employees: 360,
    createdDate: "2013-01-13 13:13:13",
    img:
      "https://ts1.cn.mm.bing.net/th/id/R-C.8a3eceef33d1599e9c4145d02f6e664c?rik=pJio3RYnkfUHzQ&riu=http%3a%2f%2fk.sinaimg.cn%2fn%2fsinakd20240716ac%2f439%2fw690h549%2f20240716%2f2029-7c53d43dd1f41d09507bc21860931b51.jpg%2fw700d1q75cms.jpg&ehk=ndOkDNmTG2rf7rfLf%2fTDtul7Hmq27fzksVxYpD44hQc%3d&risl=&pid=ImgRaw&r=0",
  },
  {
    id: "5",
    name: "YHN科技YX公司",
    city: "韶关",
    employees: 810,
    createdDate: "2012-12-12 12:12:12",
    img:
      "https://ts1.cn.mm.bing.net/th/id/R-C.8a3eceef33d1599e9c4145d02f6e664c?rik=pJio3RYnkfUHzQ&riu=http%3a%2f%2fk.sinaimg.cn%2fn%2fsinakd20240716ac%2f439%2fw690h549%2f20240716%2f2029-7c53d43dd1f41d09507bc21860931b51.jpg%2fw700d1q75cms.jpg&ehk=ndOkDNmTG2rf7rfLf%2fTDtul7Hmq27fzksVxYpD44hQc%3d&risl=&pid=ImgRaw&r=0",
  },
]);

let user = ref(JSON.parse(sessionStorage.getItem("user")));

const headerRowClassName = ({ $rowIndex }) => {
  if ($rowIndex === 0) {
    return "header__row--red";
  }
};
</script>
<style scoped lang="scss">
#mainbox {
  width: 100%;
  height: calc(100vh - 76px);
  overflow: scroll;
  .top {
    width: 100%;
    background-color: #f2fbfa;
    height: 60px;
    line-height: 60px;
    display: flex;
    img {
      margin: 15px;
      width: 30px;
    }
    p {
      font-size: 20px;
    }
  }
  .top2 {
    width: 100%;
    height: 140px;
    display: flex;
    justify-content: space-between;
    margin: 10px 0px;
    .box {
      width: 23.5%;
      height: 100%;
      background-color: white;
      border-radius: 10px;
      box-shadow: 0px 0px 2px #b5b5b5;
      display: flex;
      justify-content: space-between;
      align-items: center;
      .left {
        width: 50%;
        padding-left: 18px;
        box-sizing: border-box;
        h1 {
          margin: 5px 0px;
        }
        p {
          color: #525151;
        }
        .txt {
          display: inline-block;
          text-align: center;
          background-color: #f0efef;
          font-size: 12px;
          padding: 4px 10px;
          border-radius: 5px;
          span {
            color: #3dd4a7;
          }
          .fu {
            color: #fa746b;
          }
        }
      }
      .right {
        width: 50%;
        img {
          width: 80%;
        }
      }
    }
  }
  .top3 {
    width: 100%;
    height: 275px;
    display: flex;
    justify-content: space-between;
    margin: 20px 0px;
    .box {
      width: 31%;
      height: 100%;
      background-color: white;
      border-radius: 10px;
      box-shadow: 0px 0px 2px #b5b5b5;
      padding: 12px;
      box-sizing: border-box;
      .txt1 {
        border-left: 5px solid #3dd4a7;
        height: 20px;
        padding-left: 8px;
      }
      .main {
        width: 100%;
        height: calc(100% - 40px);
      }
    }
    .bigbox {
      width: 35%;
      .main {
        width: 100%;
        height: 85%;
        display: flex;
        justify-content: space-around;
        flex-wrap: wrap;
        align-items: center;
        .aaa {
          width: 25%;
          text-align: center;
          p {
            margin: 0px auto;
            width: 58px;
            height: 58px;
            border-radius: 50%;
            line-height: 58px;
            margin-bottom: 6px;
            img {
              width: 22px;
              margin-top: -2px;
            }
          }
          .one {
            background-color: #d8f6ed;
          }
          .two {
            background-color: #fff8e4;
          }
          .three {
            background-color: #fee3e1;
          }
          .four {
            background-color: #e2e4fd;
          }
          span {
            font-size: 14px;
          }
        }
      }
    }
  }
  .top4 {
    width: 100%;
    height: 420px;
    background-color: white;
    margin: 20px 0px;
    border-radius: 10px;
    padding: 12px;
    box-sizing: border-box;
    .txt1 {
      border-left: 5px solid #3dd4a7;
      height: 20px;
      padding-left: 8px;
    }
    .cenbox {
      width: 100%;
      height: calc(100% - 30px);
    }
  }

  .bottom {
    width: 100%;
    height: 420px;
    margin: 20px 0px;
    display: flex;
    justify-content: space-between;
    .boxten {
      width: 49%;
      height: 100%;
      background-color: white;
      background-color: #fa746b;
      border-radius: 10px;
      padding: 16px;
      box-sizing: border-box;
      .txt1 {
        border-left: 5px solid #3dd4a7;
        height: 20px;
        padding-left: 8px;
      }
      .header-style {
        display: block;
        width: 100%;
      }
    }
  }
}
::-webkit-scrollbar {
  width: 0px;
  height: 0px;
}
</style>
